package Practice18;

import java.util.Arrays;

public class ComparatorLambdaTest {
    public static void main(String[] args) {
        Person[] array = {
                new Person("古力娜扎", 12),
                new Person("迪丽热巴", 34),
                new Person("玛尔扎哈", 23)
        };
        Arrays.sort(array, (Person a, Person b) -> {
            return a.getAge() - b.getAge();
        });
        for (Person person : array) {
            System.out.println(person);
        }
        ;
    }
}
